﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Hypergraph
{
    public partial class HypergraphController : UserControl, IHypergraphObserver
    {
        public HypergraphController()
        {
            InitializeComponent();
        }

        #region IsubjectObserver Members
        private IHypergraph subject;
        public IHypergraph Subject
        {
            set
            {
                subject = value;
                SubjectChanged();
            }
        }

        private void SubjectChanged()
        {
            if (subject == null) return;
            TrackBarOuterDisk.Value = (int)subject.OuterRingRadius;
        }
        #endregion

        private void TrackBarOuterDisk_Scroll(object sender, EventArgs e)
        {
            Changed();
        }

        private void Changed()
        {
            if (subject == null) return;
            subject.Clear();
            subject.OuterRingRadius = TrackBarOuterDisk.Value;
        }
    }
}
